<?php
class RegisterAction extends PublicAction
{
	public function index()
	{
		$this -> display();
	}
	public function Verify()
	{
		$User = D('User');
		$result = $User -> Create();
		if(!$result)
		{ 
			$this -> error($User -> getError());
		}
		else
		{
			$User -> PID = D('Privilege')->C('PRIVILEGE_REGISTERED',0);
			$User -> password = sha1($User -> password);
			$User -> answer = sha1($User -> answer);
			$User -> add();
			$user = $User -> order('UID desc') -> find();
			$P = D('Privilege');
			$_SESSION['login'] = true;
			$_SESSION['UID'] = $user['UID'];
			$_SESSION['UserName'] = $user['username'];
			$_SESSION['PLevel'] = D('Privilege')->C('PRIVILEGE_REGISTERED');
			$this -> assign('jumpUrl', '/Index/index/');
			$this -> success('注册成功！现在跳转回首页~');
		}
	}
}
?>